package com.nbsaas.boot.entity.evaluate;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.code.annotation.bean.StoreStateBean;
import com.nbsaas.boot.code.annotation.data.Dict;
import com.nbsaas.boot.code.annotation.data.DictItem;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import com.nbsaas.boot.jpa.data.entity.User;
import com.nbsaas.boot.rest.enums.StoreState;
import com.nbsaas.boot.rest.filter.Operator;
import jakarta.persistence.*;
import lombok.Data;
import org.hibernate.annotations.Comment;

/**
 * 评价回复
 * 
 * @author 系统生成
 */
@Comment("评价回复")
@FormAnnotation(title = "评价回复管理", model = "评价回复")
@StoreStateBean
@CreateByUser
@Data
@Entity
@Table(name = "bs_evaluate_reply")
public class EvaluateReply extends AbstractEntity {

    @Comment("关联评价")
    @SearchItem(label = "关联评价", name = "evaluate", key = "evaluate.id", operator = Operator.eq, classType = Long.class)
    @FormField(title = "关联评价", sortNum = "10", grid = true, required = true, type = InputType.select, option = "evaluate")
    @FieldConvert
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false)
    private Evaluate evaluate;

    @Comment("父回复")
    @SearchItem(label = "父回复", name = "parentReply", key = "parentReply.id", operator = Operator.eq, classType = Long.class)
    @FormField(title = "父回复", sortNum = "20", grid = true, type = InputType.select, option = "evaluateReply")
    @FieldConvert
    @ManyToOne(fetch = FetchType.LAZY)
    private EvaluateReply parentReply;

    @Comment("回复用户")
    @SearchItem(label = "回复用户", name = "replyUser", key = "replyUser.id", operator = Operator.eq, classType = Long.class)
    @FormField(title = "回复用户", sortNum = "30", grid = true, required = true, type = InputType.select, option = "user")
    @FieldName
    @FieldConvert
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false)
    private User replyUser;

    @Comment("被回复用户")
    @SearchItem(label = "被回复用户", name = "targetUser", key = "targetUser.id", operator = Operator.eq, classType = Long.class)
    @FormField(title = "被回复用户", sortNum = "40", grid = true, type = InputType.select, option = "user")
    @FieldName
    @FieldConvert
    @ManyToOne(fetch = FetchType.LAZY)
    private User targetUser;

    @Comment("回复类型")
    @SearchItem(label = "回复类型", name = "replyType", operator = Operator.eq, classType = Integer.class, type = InputType.dictionary)
    @FormField(title = "回复类型", sortNum = "50", grid = true, type = InputType.dictionary)
    @Dict(
            items = {
                    @DictItem(value = 1, label = "商家回复"),
                    @DictItem(value = 2, label = "用户追评"),
                    @DictItem(value = 3, label = "用户回复"),
                    @DictItem(value = 4, label = "系统回复")
            }
    )
    private Integer replyType;

    @Comment("回复内容")
    @SearchItem(label = "回复内容", name = "content", operator = Operator.like)
    @FormField(title = "回复内容", sortNum = "60", grid = true, required = true, type = InputType.textarea, col = 23)
    @Column(length = 2000, nullable = false)
    private String content;

    @Comment("回复图片")
    @FormField(title = "回复图片", sortNum = "70", grid = true)
    @Column(length = 1000)
    private String images;

    @Comment("是否匿名")
    @SearchItem(label = "是否匿名", name = "anonymous", operator = Operator.eq, classType = Integer.class, type = InputType.dictionary)
    @FormField(title = "是否匿名", sortNum = "80", grid = true, type = InputType.dictionary)
    @Dict(
            items = {
                    @DictItem(value = 0, label = "否"),
                    @DictItem(value = 1, label = "是")
            }
    )
    private Integer anonymous;

    @Comment("点赞数量")
    @FormField(title = "点赞数量", sortNum = "90", grid = true, type = InputType.el_input_number, sort = true)
    private Integer likeCount;

    @Comment("回复层级")
    @FormField(title = "回复层级", sortNum = "100", grid = true, type = InputType.el_input_number)
    private Integer level;

    @Comment("回复路径")
    @FormField(title = "回复路径", sortNum = "110", grid = true)
    @Column(length = 500)
    private String replyPath;

    @Comment("回复状态")
    @SearchItem(name = "storeState", label = "状态", operator = Operator.eq, classType = StoreState.class)
    @FormField(title = "状态", sortNum = "120", grid = true, type = InputType.dictionary)
    private StoreState storeState;

    @Comment("审核备注")
    @FormField(title = "审核备注", sortNum = "130", grid = true, type = InputType.textarea)
    @Column(length = 500)
    private String auditNote;

    @Comment("IP地址")
    @FormField(title = "IP地址", sortNum = "140", grid = true)
    @Column(length = 50)
    private String ipAddress;

    @Comment("用户代理")
    @FormField(title = "用户代理", sortNum = "150", grid = true)
    @Column(length = 500)
    private String userAgent;
} 